<template>
  <el-dialog :title="$t('label_message_notify')" :visible.sync="visible" custom-class="dialog_big">
    <div v-loading="loading">
      <div class="flex_center bold pd_3 text_title">{{ form.title }}</div>
      <div class="" style="color:#999;text-align: end;">
        {{ $t('label_publish_time') }}: {{ $dateFormat(form.publishDate) }}
      </div>
      <div class="pd_1 over_auto" style="height:500px" v-html="form.content">
      </div>
      <!-- <span slot="footer" class="dialog-footer">
        <el-button @click="visible = false">{{ $t('label_close') }}</el-button>
      </span> -->
    </div>
  </el-dialog>

</template>

<script>

export default {

  data() {
    return {
      loading: false,
      visible: false,
      form: {},
    }
  },
  methods: {
    show(id,isRead) {
      this.loading = true
      this.visible = true
      this.$ajax({
        url: '/oms-api/client/OmsBaseNotifyClientRpc/detail.json',
        data: {
          id: id
        },
        success: (res) => {
          this.form = Object.assign({}, res.data)
          if (isRead == "N") {
            this.$ajax({
              url: '/oms-api/client/OmsBaseNotifyClientRpc/markerRead.json',
              type: "json",
              data: {
                id: id
              },
              success: (res) => {
                this.$emit('readFinish')
                this.$store.dispatch('refreshNotice')
              },
              fail: () => { }
            })
          }
        },
        complete: () => {
          this.loading = false
        }
      })
    },

  },
}
</script>
